<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script src="../js/abc.js"></script>
<style type="text/css">
body, html {
	width: 100%;
	text-align: center;
}
#picyzm {
	width: 100px;
	height: 40px;
	display: inline-block;
	margin: 0 30px;
}
#verifyCodeDemo {
	width: 100%;
	display: flex;
	margin-top: 200px;
	justify-content: center;
}
#btn {
	margin: 30px auto;
	background-color: blue;
	color: #fff;
	border-radius: 5px;
	border: 0;
	width: 100px;
	height: 40px;
}
</style>
</head>
<body>
	<div id="verifyCodeDemo">
		<input type="text" id="code_input" placeholder="在这个框里输入验证码">
		<p id="picyzm"></p>
	</div>
	<input type="button" value="验证" id="btn">
   
	<script type="text/javascript">
		//初始化验证码
		var verifyCode = new GVerify({
			id : "picyzm",
			type : "blend"
		});
		//点击按钮验证
		var code = document.getElementById("code_input");
		var btn = document.getElementById("btn");
		btn.onclick = function() {
			var res = verifyCode.validate(code.value);
			if (res) {
				alert("验证通过");
			} else {
				alert("验证码错误");
			}
		}
	</script>
</html>
